//
//  GifCollectionViewCell.m
//  GIFShow
//
//  Created by lanou11air029 on 15/5/1.
//  Copyright (c) 2015年 CK. All rights reserved.
//

#import "GifCollectionViewCell.h"
#import <SDWebImage/UIImageView+WebCache.h>
@interface GifCollectionViewCell ()
@property (nonatomic, strong) UIImageView * gifView;
@property (nonatomic, strong) UILabel * title;
@end
@implementation GifCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.gifView = [[UIImageView alloc]initWithFrame:CGRectMake(2, 2, frame.size.width-4, frame.size.height-4)];
        self.title = [[UILabel alloc]initWithFrame:CGRectMake(2, frame.size.height-25, frame.size.width-4, 21)];
        [self.contentView addSubview:self.gifView];
        [self.contentView addSubview:self.title];
    }
    return self;
}
-(void)setGifItem:(GifDownload *)gifItem{
    if (_gifItem != gifItem) {
        _gifItem = gifItem;
        [self.gifView sd_setImageWithURL:[NSURL URLWithString:gifItem.mainImageUrl] placeholderImage:[UIImage imageNamed:@"placeholder"]];
        self.title.text = gifItem.content;
    }
}
@end
